package com.example.pei.ithinklearnt.adapter;


import android.content.Context;
import android.view.View;

import com.example.pei.ithinklearnt.R;
import com.example.pei.ithinklearnt.adapter.base.BaseRecyclerAdapter;
import com.example.pei.ithinklearnt.adapter.base.BaseRecyclerHolder;
import com.example.pei.ithinklearnt.bean.Friend;
import com.example.pei.ithinklearnt.bean.UserInfo;
import com.example.pei.ithinklearnt.db.NewFriendManager;
import com.example.pei.ithinklearnt.view.base.IMutlipleItem;

import java.util.Collection;

/**联系人
 * 一种简洁的Adapter实现方式，可用于多种Item布局的recycleView实现，不用再写ViewHolder啦
 * @author :smile
 * @project:ContactNewAdapter【
 * @date :2016-04-27-14:18
 */
public class ContactAdapter extends BaseRecyclerAdapter<UserInfo> {



    public ContactAdapter(Context context, IMutlipleItem<UserInfo> items, Collection<UserInfo> datas) {
        super(context,items,datas);
    }


    @Override
    public void bindView(BaseRecyclerHolder holder, UserInfo user, int position) {
        if(holder.layoutId== R.layout.item_contact){
            //好友头像
            holder.setImageView(user == null ? null : user.getHeadFileUrl(), R.drawable.default_head, R.id.iv_recent_avatar);
            //好友名称
            holder.setText(R.id.tv_recent_name,user==null?"未知":user.getNickName());
        }
    }

}
